importClass(Packages.org.framework2.utils.XMLReader);
importClass(Packages.org.framework2.utils.HttpClientUtil);
importClass(Packages.org.framework2.utils.DBTools);

var xmlData = request.getParameter('xmldata');
//print('请求的参数:' + xmlData);
var xmlReader = new XMLReader(xmlData);
//<?xml version="1.0" encoding="UTF-8"?>
//<InnerBus><Response><RspCode>000000</RspCode><RspDesc>SUCCESS</RspDesc></Response></InnerBus>
var ret = '<?xml version="1.0" encoding="UTF-8"?>';
ret += '<InnerBus>';
ret += '<Response>';
ret += '<RspCode>000000</RspCode>';
ret += '<RspDesc>[TMPT]SUCCESS</RspDesc>';
ret += '</Response>';
ret += '</InnerBus>';
response.write(ret);
/*
如果是发送到门户的请求则发起回执
/CMS4-DIST/ibus/confirmDeployForColorringController.do
var logs = dbTools.select('select \'中文\' from dual');
println(logs);
var map = new java.util.HashMap();
map.put('xmlData',ret);
HttpClientUtil.post('http://localhost:8888/testCase/testcase2.do', 5000, map);
<?xml version="1.0" encoding="utf-8"?>
												<Cms>
													<SvcCont>
														<DeployReportReq>
															<EnableID>0</EnableID>
															<Action>4</Action>
															<TransactionID>000167641244</TransactionID>
															<Result>0</Result>
															<CmpID>011</CmpID>
															<ContentID>600920000000000891</ContentID>
														</DeployReportReq>
													</SvcCont>

													<ProcID>1201006041547114061294035</ProcID>
												</Cms>

*/
var transID = xmlReader.getNodeText('InnerBus.SvcCont.DeployPictrueReq.TransactionID');
var targetDeviceID = xmlReader.getNodeText('InnerBus.SvcCont.DeployPictrueReq.TargetDeviceID');
var procID = xmlReader.getNodeText('InnerBus.ProcID');
//
if('0' == targetDeviceID){
	var retStr = '<?xml version="1.0" encoding="utf-8"?>';
	retStr += '<Cms>';
	retStr += '<SvcCont>';
	retStr += '<DeployReportReq>';
	retStr += '<EnableID>0</EnableID>';
	retStr += '<EnableID>0</EnableID>';
	retStr += '<TransactionID>'+transID+'</TransactionID>';
	retStr += '<Result>0</Result>';
	retStr += '<CmpID>011</CmpID>';
	retStr += '<ContentID>xxxxxxxxxxxxxxxxxxxx</ContentID>';
	retStr += '</DeployReportReq>';
	retStr += '</SvcCont>';
	retStr += '<ProcID>a' + procID + '</ProcID>';
	retStr += '</Cms>';
	var map = new java.util.HashMap();
	map.put('xmldata',retStr);
	println(retStr);
	HttpClientUtil.post('http://10.25.102.143:5657/CMS4-DIST/ibus/confirmPortalForMusicController.do', 5000, map);
}
